package com.cc.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 33314
 * @version 1.0
 * @description: TODO
 * @date 2025/5/26 14:07
 */
public class DateUtil {
    public static Date stringToDate(String dateString) {
        String pattern = "yyyy-MM-dd"; // 注意月份是大写 MM
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        try {
            return sdf.parse(dateString);
        } catch (ParseException e) {
            throw new RuntimeException("日期格式转换失败: " + dateString, e);
        }
    }


}
